package com.sdsy.blockchaintrainingback.controller.network;

import com.sdsy.blockchaintrainingback.pojo.common.CommonResult;
import com.sdsy.blockchaintrainingback.service.network.NetworkService;
import com.sdsy.blockchaintrainingback.vo.network.NetworkCreateVo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.sdsy.blockchaintrainingback.pojo.common.CommonResult.success;

/**
 * @Description TODO
 * @Author linzili
 * @Date 2023/9/27 18:51
 * @Version 1.0
 */
@RestController
@RequestMapping("/network")
public class NetworkController {

    @Resource
    private NetworkService networkService;

    @PostMapping
    public CommonResult<Boolean> network(@RequestBody NetworkCreateVo vo) {
        return success(networkService.createNetwork(vo.getName(),vo.getSubnet()));

    }
}
